﻿#region License
// (c) Garry McGlennon 2009
// 
// This project is made available under the Microsoft Public License (Ms-PL)
// Code is provided as is and with no warrenty – Use at your own risk
// 
// View the project and the latest code at http://dnpframework.codeplex.com/
// 
// All other rights reserved.
// 
// blog: www.dotNetProfessional.com/blog/
#endregion
using dnp.ServiceModel.Configuration;
using dnp.Framework.Scripting;

namespace dnp.ServiceModel
{
    public class ServiceMetaData
    {
        private readonly ServiceMetaDataDefinition _definition;
        private readonly dnpModel _model;

        public ServiceMetaData(ServiceMetaDataDefinition definition, dnpModel model)
        {
            _definition = definition;
            _model = model;
        }

        public dnpModel Model
        {
            get { return _model; }
        }

        public string Filename(BusinessService service)
        {
            return Naming.EvaluateNamingExpression(_definition.Filename, service);
        }

        public string GeneratedFilename(BusinessService service)
        {
            return Naming.EvaluateNamingExpression(_definition.GeneratedFilename, service);
        }

        public string InterfaceName(BusinessService service)
        {
            return Naming.EvaluateNamingExpression(_definition.InterfaceName, service);            
        }

        public string InterfaceRelativeNamespace(BusinessService service)
        {
            return Naming.EvaluateNamingExpression(_definition.InterfaceRelativeNamespace, service);
        }
        public string InterfaceFilename(BusinessService service)
        {
            return Naming.EvaluateNamingExpression(_definition.InterfaceFilename, service);
        }

        public string InterfaceGeneratedFileame(BusinessService service)
        {
            return Naming.EvaluateNamingExpression(_definition.InterfaceGeneratedFilename, service);
        }
    }
}
